
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/dist/query/react";
//请求API
export const registerApi = createApi({
    reducerPath: 'registerApi',
    //设置基本请求路径
    baseQuery: fetchBaseQuery({
        baseUrl: window.app
    }),
    
    endpoints(build) {
        return {
         
            //注册请求
            postregister: build.mutation({
                query(data) {
                    return {
                        url: 'Account/accountRegister',
                        method: 'POST',
                        body:data
                    };
                },
                transformResponse(baseQuery){
                    return baseQuery.data;

                }
            })
        }
    }
});



//导出钩子函数给外部使用，自动生成hooks的名称为`use(Endpoint_name)Query`
export const { usePostregisterMutation } = registerApi;